package com.ces.knacky.model;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

import org.apache.commons.lang.builder.EqualsBuilder;

import com.ces.knacky.framework.model.AbstractMasterEntity;

/** @author Hibernate CodeGenerator */
@XmlRootElement
public class Bid extends AbstractMasterEntity  implements Serializable {

    /** nullable persistent field */
    private Float amount;

    /** persistent field */
    private com.ces.knacky.model.Auction auction;

    /** persistent field */
    private com.ces.knacky.model.Item item;
    
    private Set<BidWorkflowAudit> bidWorkFlowAudits;   
    
    private OrderTable order;

	/** full constructor */
    public Bid(Date createTime, Date updateTime, Float amount, com.ces.knacky.model.Auction auction, com.ces.knacky.model.Flag flag, com.ces.knacky.model.Item item, com.ces.knacky.model.UserTable user) {
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.amount = amount;
        this.auction = auction;
        this.flag = flag;
        this.item = item;
        this.user = user;
    }

    /** default constructor */
    public Bid() {
    }

    /** minimal constructor */
    public Bid(com.ces.knacky.model.Auction auction, com.ces.knacky.model.Flag flag, com.ces.knacky.model.Item item, com.ces.knacky.model.UserTable user) {
        this.auction = auction;
        this.flag = flag;
        this.item = item;
        this.user = user;
    }


    public Float getAmount() {
        return this.amount;
    }

    public void setAmount(Float amount) {
        this.amount = amount;
    }

    public com.ces.knacky.model.Auction getAuction() {
        return this.auction;
    }

    public void setAuction(com.ces.knacky.model.Auction auction) {
        this.auction = auction;
    }

    public com.ces.knacky.model.Flag getFlag() {
        return this.flag;
    }

    public void setFlag(com.ces.knacky.model.Flag flag) {
        this.flag = flag;
    }

    public com.ces.knacky.model.Item getItem() {
        return this.item;
    }

    public void setItem(com.ces.knacky.model.Item item) {
        this.item = item;
    }

    public com.ces.knacky.model.UserTable getUser() {
        return this.user;
    }

    public void setUser(com.ces.knacky.model.UserTable user) {
        this.user = user;
    }
    
    @XmlTransient
    public Set<BidWorkflowAudit> getBidWorkFlowAudits() {
		return bidWorkFlowAudits;
	}

	public void setBidWorkFlowAudits(Set<BidWorkflowAudit> bidWorkFlowAudits) {
		this.bidWorkFlowAudits = bidWorkFlowAudits;
	}

	public OrderTable getOrder() {
		return order;
	}

	public void setOrder(OrderTable order) {
		this.order = order;
	}
	
    public boolean equals(Object other) {
        if ( !(other instanceof Bid) ) return false;
        Bid castOther = (Bid) other;
        return new EqualsBuilder()
            .append(this.getId(), castOther.getId())
            .isEquals();
    }
}
